<template>
  <div class="content content50">
    <div class="innertitle" style="display: flex; align-items: center;">
      1.剂量偏差与重复性：
      （<el-radio-group v-model="form.doseDeviationRepeatability.type" class="split-radio">
        <el-radio :label="1">TRS-398</el-radio>
        <el-radio :label="2">TRS-277</el-radio>
      </el-radio-group>）
      <span style="margin-left: auto;">标准技术要求：≤3%，≤0.5%</span>
    </div>

    <el-popover
      placement="bottom"
      width="300"
      trigger="hover"
    >
      <span style="float: right;" slot="reference">
        <i class="el-icon-more" style="font-size: 24px; cursor: pointer; color: #409EFF;"></i>
      </span>

      <div style="cursor: pointer; font-size: 14px; color: #409EFF; text-decoration: underline;">
        <div @click="handleOpenDesrcibeDialog(1)">
          1、表V，光子束水中深度z处<i>$\overline E_z$</i>与模体表面<i>$\overline E_0$</i>平均能量之比，
          深度用<i>$R_p$</i>的分数给出。
        </div>
        <div style="margin-top: 10px;" @click="handleOpenDesrcibeDialog(2)">
          2、表IV，电子束在水模体表面的平均能量<i>$\overline E_0$</i>与宽束条件下SSD=1m时剂量和电离曲线的半值深度。
        </div>
        <div style="margin-top: 10px;" @click="handleOpenDesrcibeDialog(3)">
          3、表X，不同<i>$\overline E_0$</i>和不同水深时电子束的水与空气阻止本领比(<i>$S_{w,air}$</i>)。
        </div>
        <div style="margin-top: 10px;" @click="handleOpenDesrcibeDialog(4)">
          4、表XI，电子束的扰动修正因子。对于不用平均能量<i>$\overline E_z$</i>，
          在水模中参数深度，空腔长度为15mm，内半径为r的圆柱指形电离室的<i>$P_u$</i>值。
        </div>
        <div style="margin-top: 10px;" @click="handleOpenDesrcibeDialog(5)">
          5、表XIII，不同光子束能量参考深度处水与空气的阻止本领比(<i>$S_{w,air}$</i>)。
        </div>
      </div>
    </el-popover>

    <div v-if="form.doseDeviationRepeatability.type == 1">
      <div>
        电离室校准因子N<sub>d</sub>（
          <el-radio-group v-model="form.doseDeviationRepeatability.rangeType" class="split-radio">
            <el-radio :label="1">Range Low</el-radio>
            <el-radio :label="2">Range Medium</el-radio>
          </el-radio-group>
        ）：
        <template v-if="form.doseDeviationRepeatability.rangeType == 1">
          <el-input class="input-line result" v-model="form.doseDeviationRepeatability.rangeLow" disabled></el-input>，
        </template>
        <template v-if="form.doseDeviationRepeatability.rangeType == 2">
          <el-input class="input-line result" v-model="form.doseDeviationRepeatability.rangeMedium" disabled></el-input>，
        </template>
        温度：<el-input v-model="form.doseDeviationRepeatability.temperature" class="input-line" />℃，
        气压：<el-input v-model="form.doseDeviationRepeatability.pressure" class="input-line" />kPa，
        K<sub>tp</sub>：<el-input v-model="form.doseDeviationRepeatability.ktp" class="input-line" />
        半径：<el-input v-model="form.doseDeviationRepeatability.r" class="input-line result" disabled />
      </div>
      <table border="1" cellspacing="0" cellpadding="0" align="center" style="width: 100%;">
        <tr>
          <td rowspan="2">辐射类型</td>
          <td rowspan="2">能量(MV)</td>
          <td rowspan="2" style="width: 90px;">TPR20/10</td>
          <td rowspan="2" style="width: 75px;">测量深度<br/>d(cm)</td>
          <td rowspan="2" style="width: 75px;">PDD(%)</td>
          <td colspan="5">实测读数(cGy)</td>
          <td rowspan="2" style="width: 70px;">K<sub>Q</sub></td>
          <td rowspan="2" style="width: 70px;">偏差<br/>(%)</td>
          <td rowspan="2" style="width: 50px;"></td>
        </tr>
        <tr>
          <td v-for="idx in 5" :key="idx" style="width: 120px;">R{{ idx }}</td>
        </tr>
        <tr v-for="(item, index) in xRayItems" :key="index">
          <td style="width: 80px;">X射线</td>
          <td style="width: 90px;">
            <el-input v-model="item.energyLevel"></el-input>
          </td>
          <td>
            <el-input v-model="item.tpr2010"></el-input>
          </td>
          <td :class="{ result: item.radiationType == 2 }">
            <el-input v-model="item.fathom" :disabled="item.radiationType == 2"></el-input>
          </td>
          <td>
            <el-input v-model="item.pdd"></el-input>
          </td>
          <td v-for="idx in 5" :key="idx">
            <el-input v-model="item['measuredValue' + idx]"></el-input>
          </td>
          <td class="result">
            <el-input v-model="item.kq" disabled></el-input>
          </td>
          <td class="result">
            <el-input v-model="item.deviation" disabled></el-input>
          </td>
          <td style="width: 100px; cursor: pointer;">
            <el-link type="primary" @click="handleAdd398ItemsRow(1)">添行</el-link>
            <el-link type="primary" style="margin-left: 10px; color: red;" @click="handleDelete398ItemsRow(1, item, index)" v-if="index > 0">删行</el-link>
          </td>
        </tr>
      </table>

      <table border="1" cellspacing="0" cellpadding="0" align="center" style="width: 100%; margin-top: 15px;">
        <tr>
          <td rowspan="2">辐射类型</td>
          <td rowspan="2">能量(MeV)</td>
          <td rowspan="2" style="width: 90px;">射线质<br/>R50(cm)</td>
          <td rowspan="2" style="width: 75px;">测量深度<br/>d(cm)</td>
          <td rowspan="2" style="width: 75px;">PDD(%)</td>
          <td colspan="5">实测读数(cGy)</td>
          <td rowspan="2" style="width: 70px;">K<sub>Q</sub></td>
          <td rowspan="2" style="width: 70px;">偏差<br/>(%)</td>
          <td rowspan="2" style="width: 50px;"></td>
        </tr>
        <tr>
          <td v-for="idx in 5" :key="idx" style="width: 120px;">R{{ idx }}</td>
        </tr>
        <tr v-for="(item, index) in eleRayItems" :key="index">
          <td style="width: 80px;">电子线</td>
          <td style="width: 90px;">
            <el-input v-model="item.energyLevel"></el-input>
          </td>
          <td>
            <el-input v-model="item.actinogen_r50"></el-input>
          </td>
          <td :class="{ result: item.radiationType == 2 }">
            <el-input v-model="item.fathom" :disabled="item.radiationType == 2"></el-input>
          </td>
          <td>
            <el-input v-model="item.pdd"></el-input>
          </td>
          <td v-for="idx in 5" :key="idx">
            <el-input v-model="item['measuredValue' + idx]"></el-input>
          </td>
          <td class="result">
            <el-input v-model="item.kq" disabled></el-input>
          </td>
          <td class="result">
            <el-input v-model="item.deviation" disabled></el-input>
          </td>
          <td style="width: 100px; cursor: pointer;">
            <el-link type="primary" @click="handleAdd398ItemsRow(2)">添行</el-link>
            <el-link type="primary" style="margin-left: 10px; color: red;" @click="handleDelete398ItemsRow(2, item, index)" v-if="index > 0">删行</el-link>
          </td>
        </tr>
      </table>
    </div>

    <div v-if="form.doseDeviationRepeatability.type == 2">
      <div>
        机架角度：0°，线束系统：0°，
        SSD：<el-input v-model="form.doseDeviationRepeatability.ssd" class="input-line"></el-input>cm，
        温度：<el-input v-model="form.doseDeviationRepeatability.temperature" class="input-line" />℃，
        气压：<el-input v-model="form.doseDeviationRepeatability.pressure" class="input-line" />kPa，
        半径：<el-input v-model="form.doseDeviationRepeatability.r" class="input-line result" disabled />
      </div>
      <table border="1" cellspacing="0" cellpadding="0" align="center" style="width: 100%;">
        <tr>
          <td>K<sub>m</sub> * K<sub>att</sub></td>
          <td rowspan="2">
            <el-radio-group v-model="form.doseDeviationRepeatability.calibrationType" class="split-radio">
              <el-radio :label="1">N<sub>k</sub></el-radio>
              <el-radio :label="2">N<sub>x</sub></el-radio>
            </el-radio-group>
          </td>
          <td rowspan="2" style="width: 160px;">
            <span v-if="!form.doseDeviationRepeatability.calibrationType || form.doseDeviationRepeatability.calibrationType == 1">
              空气比释动能校准因子<br/>N<sub>k</sub>
            </span>
            <span v-if="form.doseDeviationRepeatability.calibrationType == 2">
              照射量校准因子<br/>N<sub>x</sub>
            </span>
          </td>
          <td>
            <el-radio-group v-model="form.doseDeviationRepeatability.rangeType" class="split-radio">
              <el-radio :label="1">量程I</el-radio>
              <el-radio :label="2">量程II</el-radio>
            </el-radio-group>
          </td>
          <td>韧致辐射能量份额g</td>
          <td>K<sub>tp</sub></td>
          <td>W/e</td>
          <td>预设剂量<br/>(Gy)</td>
        </tr>
        <tr>
          <td class="result">
            <el-input v-model="form.doseDeviationRepeatability.kmkatt" disabled />
          </td>
          <td class="result">
            <!-- TRS-398 -->
            <template v-if="form.doseDeviationRepeatability.type == 1">
              <el-input v-model="form.doseDeviationRepeatability.rangeLow" v-if="form.doseDeviationRepeatability.rangeType == 1" disabled></el-input>
              <el-input v-model="form.doseDeviationRepeatability.rangeMedium" v-if="form.doseDeviationRepeatability.rangeType == 2" disabled></el-input>
            </template>
            <!-- TRS-277 -->
            <template v-if="form.doseDeviationRepeatability.type == 2">
              <el-input v-model="form.doseDeviationRepeatability.rangeOne" v-if="form.doseDeviationRepeatability.rangeType == 1" disabled></el-input>
              <el-input v-model="form.doseDeviationRepeatability.rangeTwo" v-if="form.doseDeviationRepeatability.rangeType == 2" disabled></el-input>
            </template>
          </td>
          <td>
            <el-input v-model="form.doseDeviationRepeatability.g"></el-input>
          </td>
          <td class="result">
            <el-input v-model="form.doseDeviationRepeatability.ktp" disabled></el-input>
          </td>
          <td>
            <el-input v-model="form.doseDeviationRepeatability.we"></el-input>
          </td>
          <td>
            <el-input v-model="form.doseDeviationRepeatability.presetDoses"></el-input>
          </td>
        </tr>
        <tr>
          <td colspan="8">
            <div v-for="(item, index) in form.doseDeviationRepeatability.items" :key="index" style="margin-bottom: 10px;">
              <table border="1" cellspacing="0" cellpadding="0" align="center" style="width: 100%;">
                <tr>
                  <td colspan="10" style="text-align: left;">
                    辐射类型:
                    <el-radio-group v-model="item.radiationType" class="split-radio">
                      <el-radio :label="1">X射线</el-radio>
                      <el-radio style="margin-left: 10px;" :label="2">电子线</el-radio>
                    </el-radio-group>;
                    能量档:
                    <el-input v-model="item.energyLevel" class="input-line"></el-input>
                    <span v-if="item.radiationType">{{ item.radiationType == 1 ? 'MV' : 'MeV' }}</span>;
                    剂量率:
                    <el-input v-model="item.oseRate" class="input-line"></el-input>Gy/min,
                    射野:
                    <el-input v-model="item.beamValue1" class="input-line"></el-input>×
                    <el-input v-model="item.beamValue2" class="input-line"></el-input>cm,
                    S<sub>w,air</sub>:
                    <el-input v-model="item.swair" class="input-line result" disabled></el-input>,
                    P<sub>u</sub>:
                    <el-input v-model="item.pu" class="input-line" :class="{'result': item.radiationType == 2}" :disabled="item.radiationType == 2"></el-input>,
                    P<sub>cel</sub>:
                    <el-input v-model="item.pcel" class="input-line"></el-input>；
                    <br/>
                    <template v-if="item.radiationType == 1">
                      pdd：
                      <el-input v-model="item.pdd" class="input-line"></el-input>%,
                      D<sub>20</sub>/D<sub>10</sub>:
                      <el-input v-model="item.d20D10" class="input-line"></el-input>,
                      TPR<sup>20</sup><sub style="margin-left: -13px;">10</sub>：
                      <el-input v-model="item.tpr2010" class="input-line"></el-input>,
                    </template>
                    <br/>
                    <template v-if="item.radiationType == 2">
                      d：
                      <el-input v-model="item.d" class="input-line"></el-input>cm,
                      R<sub>p</sub>:
                      <el-input v-model="item.rp" class="input-line"></el-input>cm,
                      R<sub>50</sub>:
                      <el-input v-model="item.r50" class="input-line"></el-input>cm,
                      E<sub>0</sub>:
                      <el-input class="result" v-model="item.e0" style="width: 100px;" disabled></el-input>MeV,
                      E<sub>z</sub>:
                      <el-input v-model="item.ez" class="input-line result" disabled></el-input>MeV,
                    </template>
                  </td>
                  <td rowspan="4" style="width: 50px; cursor: pointer;" @click="handleDeleteItemsRow(index)">
                    <span style="color: red;" v-if="index > 0">删除</span>
                  </td>
                </tr>
                <tr>
                  <td colspan="5">实测读数(Gy)</td>
                  <td rowspan="2">总校准因子</td>
                  <td rowspan="2">平均值</td>
                  <td rowspan="2">修正值<br/>(cGy)</td>
                  <td rowspan="2">重复性<br/>(%)</td>
                  <td rowspan="2">偏差<br/>(%)</td>
                </tr>
                <tr>
                  <td v-for="idx in 5" :key="idx" style="width: 120px;">R{{ idx }}</td>
                </tr>
                <tr>
                  <td v-for="idx in 5" :key="idx">
                    <el-input v-model="item['measuredValue' + idx]"></el-input>
                  </td>
                  <td class="result">
                    <el-input v-model="item.totalCalibrationFactor" disabled></el-input>
                  </td>
                  <td class="result">
                    <el-input v-model="item.avg" disabled></el-input>
                  </td>
                  <td class="result">
                    <el-input v-model="item.correctionValue" disabled></el-input>
                  </td>
                  <td class="result">
                    <el-input v-model="item.cv" disabled></el-input>
                  </td>
                  <td class="result">
                    <el-input v-model="item.deviation" disabled></el-input>
                  </td>
                </tr>
              </table>
            </div>
            <div style="text-align: center; margin-top: 10px;">
              <span
                style="
                  display: inline-block;
                  width: 80px;
                  padding: 5px 0;
                  border: 1px solid #ccc;
                  color: #888;
                  font-size: 16px;
                  border-radius: 2px;
                  cursor: pointer;
                  position: relative;
                  z-index: 999;
                "
                @click="handleAddItemsRow"
              >+</span>
            </div>
          </td>
        </tr>
      </table>
    </div>

    <div style="margin-top: 10px; display: flex; align-items: center; flex-wrap: wrap;">
      计算公式：
      <span>
        K<sub>tp</sub> = [(273.15 + T) / 293.15] × 101.3 / p
      </span>，
      <span>
        D = <span style="height: 30px; border-top: 1px solid #aaa;">M</span> × N<sub>k</sub> × (1 - g) × K<sub>m</sub>*K<sub>att</sub> × K<sub>tp</sub> × S<sub>w,air</sub> × P<sub>u</sub> × P<sub>cel</sub>
        或 D = <span style="height: 30px; border-top: 1px solid #aaa;">M</span> × N<sub>x</sub> × (W/e) × K<sub>m</sub>*K<sub>att</sub> × K<sub>tp</sub> × S<sub>w,air</sub> × P<sub>u</sub> × P<sub>cel</sub>
      </span>
    </div>
    <div style="margin-top: 10px; display: flex; align-items: center; flex-wrap: wrap;">
      <span>
        D<sub>v</sub> = (M - D<sub>0</sub>) / D<sub>0</sub> × 100%
      </span>，
    </div>
    <div style="display: flex; align-items: center;">
      R=<img src="@/assets/images/test_item50/form1_formula2.png" alt="" style="margin-right: 50px;"><img
        src="@/assets/images/test_item50/form1_formula3.png" alt="">
    </div>
    <div class="innertitle" style="display: flex;justify-content: space-between;">
      2.剂量线性<span>标准技术要求：≤2%</span>
    </div>
    <div>
      机架角度：0°，线束系统：0°，SSD：100cm，照射野10cm×10cm，剂量率
      <el-input v-model="form.doseLinearity.doseRate" class="input-line" />Gy/min
    </div>
    <table border="1" cellspacing="0" cellpadding="0" align="center">
      <tr>
        <td rowspan="2" style="width: 80px;">辐射类型</td>
        <td rowspan="2" style="width: 100px;">能量档</td>
        <td rowspan="2" style="width: 100px;">预设吸收剂量</td>
        <td :colspan="doseLinearity.table.D">测量吸收剂量值（Gy）</td>
        <td rowspan="2" style="width: 90px;">均值Di<br/>（Gy）</td>
        <td rowspan="2" style="width: 150px;">线性公式</td>
        <td rowspan="2" style="width: 100px;">拟合吸收剂量<br/>（Gy）</td>
        <td rowspan="2" style="width: 80px;">最大偏差<br/>（%）</td>
      </tr>
      <tr>
        <td v-for="(rIndex) in doseLinearity.table.D" :key="rIndex">
          D<span class="miniFont" :key="rIndex">{{rIndex}}</span>
        </td>
      </tr>
      <tbody v-for="(index) in doseLinearity.table.item" :key="index">
        <tr v-for="(trIndex) in doseLinearity.table.tr" :key="trIndex">
          <td :rowspan="doseLinearity.table.tr" v-if="trIndex==1">
            <el-select v-model="form.doseLinearity['radiationType_'+index]">
              <el-option
                    :key="1"
                    label="X射线"
                    :value="1">
              </el-option>
              <el-option
                    :key="2"
                    label="电子线"
                    :value="2">
              </el-option>
            </el-select>
          </td>
          <td :rowspan="doseLinearity.table.tr" v-if="trIndex==1">
            <el-input v-model="form.doseLinearity['energyLevel_'+index]" class="input-line"></el-input>
            <span v-if="!form.doseLinearity['radiationType_'+index]">MV</span>
            <span v-if="form.doseLinearity['radiationType_'+index] == 1">MV</span>
            <span v-if="form.doseLinearity['radiationType_'+index] == 2">MeV</span>
          </td>
          <td>
            <el-input v-model="form.doseLinearity['presetAbsorbedDose_'+index+'_'+trIndex]" />
          </td>
          <td v-for="dIndex in doseLinearity.table.D" :key="dIndex">
            <el-input v-model="form.doseLinearity['measuredValue_'+index+'_'+trIndex+'_'+dIndex]" />
          </td>
          <td class="result">
            <el-input v-model="form.doseLinearity['avg_'+index+'_'+trIndex]" disabled/>
          </td>
          <td class="result" :rowspan="doseLinearity.table.tr" v-if="trIndex == 1 ">
            <span v-if="form.doseLinearity['a_'+index] && form.doseLinearity['b_'+index]">
							{{ `y = ${form.doseLinearity['a_'+index]}x${form.doseLinearity['b_'+index] > 0 ? '+' : ''} ${form.doseLinearity['b_'+index]}` }}
						</span>
            <br />
						<span style="display: inline-block; margin-top: 10px;">
							R<sup>2</sup> = {{ form.doseLinearity['r_'+index] }}
						</span>
          </td>
          <td class="result">
            <el-input v-model="form.doseLinearity['fittingAbsorbedDose_'+index+'_'+trIndex]" disabled/>
          </td>
          <td class="result">
            <el-input v-model="form.doseLinearity['maxDeviation_'+index+'_'+trIndex]" disabled/>
          </td>
        </tr>
      </tbody>
    </table>
    <div style="display: flex;align-items: center;">
      <img src="@/assets/images/test_item50/form2_formula1.png" alt="">，<img
        src="@/assets/images/test_item50/form2_formula2.png" alt="">，<img
        src="@/assets/images/test_item50/form2_formula3.png" alt="">，<img
        src="@/assets/images/test_item50/form2_formula4.png" alt="">
    </div>
    <div class="innertitle" style="display: flex;justify-content: space-between;">
      3.X射线方形照射野的均整度 <span>标准技术要求：≤106%，大于30cm≤110%</span>
    </div>
    <div>
      机架角度：
      <el-input class="input-line" v-model="form.uniformity['angle']"></el-input>°
      ，线束系统：0°，探测器水下扫描深度：
      <el-input class="input-line" v-model="form.uniformity['scanDepth']"></el-input>cm，
      SSD：90cm。
    </div>
    <table border="1" cellspacing="0" cellpadding="0" align="center">
      <tr>
        <td style="width: 200px;">能量档(MV)</td>
        <td>照射野(cm)</td>
        <td>探测器水下扫描深度cm</td>
        <td>方向</td>
        <td>均整度，%</td>
      </tr>
      <!-- 1 -->
      <tr>
        <td rowspan="4">
          <el-input v-model="form.uniformity['energyLevel_1']" style="height: 80px;"></el-input>
        </td>
        <td rowspan="2">
          <el-input style="width: 45% !important;" v-model="form.uniformity['irradiationFieldLength_1_1']"/>
           ×
          <el-input style="width: 45% !important;" v-model="form.uniformity['irradiationFieldWidth_1_1']"/>
        </td>
        <td>GT</td>
        <td>
          <el-input v-model="form.uniformity['uniformity_GT_1_1']" />
        </td>
      </tr>
      <!-- 2 -->
      <tr>
        <td>AB</td>
        <td>
          <el-input v-model="form.uniformity['uniformity_AB_1_1']" />
        </td>
      </tr>
      <!-- 3 -->
      <tr>
        <td rowspan="2">
          <el-input style="width: 45% !important;" v-model="form.uniformity['irradiationFieldLength_1_2']"/>
           ×
          <el-input style="width: 45% !important;" v-model="form.uniformity['irradiationFieldWidth_1_2']"/>
        </td>
        <td>GT</td>
        <td>
          <el-input v-model="form.uniformity['uniformity_GT_1_2']" />
        </td>
      </tr>
      <!-- 4 -->
      <tr>
        <td>AB</td>
        <td>
          <el-input v-model="form.uniformity['uniformity_AB_1_2']" />
        </td>
      </tr>
      <!-- 5 -->
      <tr>
        <td rowspan="4">
          <el-input v-model="form.uniformity['energyLevel_2']" style="height: 80px;"></el-input>
        </td>
        <td rowspan="2">
          <el-input style="width: 45% !important;" v-model="form.uniformity['irradiationFieldLength_2_1']"/>
           ×
          <el-input style="width: 45% !important;" v-model="form.uniformity['irradiationFieldWidth_2_1']"/>
        </td>
        <td>GT</td>
        <td>
          <el-input v-model="form.uniformity['uniformity_GT_2_1']" />
        </td>
      </tr>
      <!-- 6 -->
      <tr>
        <td>AB</td>
        <td>
          <el-input v-model="form.uniformity['uniformity_AB_2_1']" />
        </td>
      </tr>
      <!-- 7 -->
      <tr>
        <td rowspan="2">
          <el-input style="width: 45% !important;" v-model="form.uniformity['irradiationFieldLength_2_2']"/>
           ×
          <el-input style="width: 45% !important;" v-model="form.uniformity['irradiationFieldWidth_2_2']"/>
        </td>
        <td>GT</td>
        <td>
          <el-input v-model="form.uniformity['uniformity_GT_2_2']" />
        </td>
      </tr>
      <!-- 8 -->
      <tr>
        <td>AB</td>
        <td>
          <el-input v-model="form.uniformity['uniformity_AB_2_2']" />
        </td>
      </tr>
    </table>
    <div class="innertitle" style="display: flex;justify-content: space-between;">
      4.电子线照射野的对称性 <span>标准技术要求：≤105%</span>
    </div>
    <div>
      机架角度：
      <el-input class="input-line" v-model="form.symmetry['angle']"></el-input>°
      ，线束系统：0°，探测器水下扫描深度：
      <el-input class="input-line" v-model="form.symmetry['scanDepth']"></el-input>cm，
      SSD：90cm。限光筒尺寸：10cm×10cm。
    </div>
    <table border="1" cellspacing="0" cellpadding="0" align="center">
      <tr>
        <td style="width: 200px;">能量档(MeV)</td>
        <td>等剂量线</td>
        <td>方向</td>
        <td>均整度，%</td>
      </tr>
      <tbody v-for="(index) in symmetry.table.item" :key="index">
        <tr v-for="indexTr in symmetry.table.item2 * 2" :key="indexTr">
          <td :rowspan="symmetry.table.item2 * 2" v-if="indexTr == 1">
            <el-input v-model="form.symmetry['energyLevel_'+index]" style="height: 80px;"></el-input>
          </td>
          <td rowspan="2" v-if="(indexTr-1) % (2) == 0">
            <el-input v-model="form.symmetry['isodose_'+index+'_'+((indexTr-1) / (2) + 1)]" />
          </td>
          <td v-if="indexTr == 5">对角线1</td>
          <td v-else-if="indexTr == 6">对角线2</td>
          <td v-else>{{(indexTr-1)%2 == 0?'GT':'AB'}}</td>
          <td>
            <el-input v-if="indexTr == 5"
              v-model="form.symmetry['symmetry_diagonal_'+index+'_3'+'_1']"
              class="input-line" />
              <el-input v-else-if="indexTr == 6"
                v-model="form.symmetry['symmetry_diagonal_'+index+'_3'+'_2']"
                class="input-line" />
            <el-input v-else-if="(indexTr-1)%2 == 0"
              v-model="form.symmetry['symmetry_GT_'+index+'_'+((indexTr-1) % (2) + 1 + (indexTr-1) / (2))]"
              class="input-line" />
            <el-input v-else
              v-model="form.symmetry['symmetry_AB_'+index+'_'+((indexTr-1) % (2) - 0.5 + (indexTr-1) / (2))]"
              class="input-line" />
          </td>
        </tr>
      </tbody>
    </table>
    <div class="innertitle" style="display: flex;justify-content: space-between;">
      5.辐射束轴相对于等中心点的偏移  <span>标准技术要求：≤2mm</span>
    </div>
    <div>
      机架角度：0°，线束系统：0°，SSD：100cm。X射线，标称能量档：6MV，设定剂量：4Gy，剂量率：<el-input v-model="form.shifting.doseRate" class="input-line" />Gy/min
    </div>
    <div>
      检测结果：<el-input v-model="form.shifting.result" class="input-line" />mm。
    </div>

    <Item50DescribeDialog
      :show.sync="showItem50DescribeDialog"
      :type="currType"
    ></Item50DescribeDialog>
  </div>
</template>

<script>
import { getInfoById50, postInfo } from "@/api/testItem/item50";
import Item50DescribeDialog from "@/views/slide/component/Item50DescribeDialog.vue";

export default {
  name: "testItem50",
  components: {
    Item50DescribeDialog
  },
  data() {
    return {
      initFlag: false,
      doseDeviationRepeatability: {
        table: {
          R: 5,
          tr: 7,
        },
        flag: true,
        action: "repeatability",
        loading: false,
        notNumber: ["testItemName", "radiationType", "energyLevelUnit", "beamType", "ionizationChamber_r50", "ionizationChamber_tpr20_10"],
        intNumber: ["energyLevel"],
        like: true,
      },
      initFlag: false,
      doseLinearity: {
        table: {
          D: 5,
          item: 7,
          tr: 5,
        },
        flag: true,
        action: "doseLinearity",
        loading: false,
        notNumber: ["radiationType", "energyLevelUnit", "linearFormula"],
        intNumber: [],
        like: true,
      },
      uniformity: {
        table: {
          item: 2,
          item2: 2,
        },
        flag: true,
        action: "uniformity",
        loading: false,
        notNumber: ["energyLevelUnit", "energyLevel"],
        intNumber: [],
        like: true,
      },
      symmetry: {
        table: {
          item: 2,
          item2: 3,
        },
        flag: true,
        action: "symmetry",
        loading: false,
        notNumber: ["energyLevelUnit"],
        intNumber: [],
        like: true,
      },
      shifting: {
        flag: true,
        action: "shifting",
        loading: false,
        notNumber: [],
        intNumber: [],
        like: false,
      },
      form: {
        itemsId: 0,
        resultId: 0,
        doseDeviationRepeatability: {
          items: [{}]
        },
        doseLinearity: {},
        uniformity: {},
        symmetry: {},
        shifting: {},
      },

      showItem50DescribeDialog: false,
      currType: 0
    };
  },
  props: {
    // tab栏
    activeNameEquipment: {
      type: String,
      default: "0",
    },
    // 基本信息数据
    basicForm: {
      type: Object,
      default: () => {
        return {};
      },
    },
  },
  computed: {
    xRayItems() {
      if (!this.form.doseDeviationRepeatability || !this.form.doseDeviationRepeatability.items) return []
      return this.form.doseDeviationRepeatability.items.filter((item) => item.radiationType == 1)
    },
    eleRayItems() {
      if (!this.form.doseDeviationRepeatability || !this.form.doseDeviationRepeatability.items) return []
      return this.form.doseDeviationRepeatability.items.filter((item) => item.radiationType == 2)
    }
  },
  methods: {
    //
    handleOpenDesrcibeDialog(type) {
      this.currType = type
      this.showItem50DescribeDialog = true
      this.$nextTick(() => {
        window.MathJax.Hub.Typeset();
      })
    },
    // 剂量偏差与重复性 => (398)添行 1: X射线 2: 电子线
    handleAdd398ItemsRow(type = 1) {
      this.form.doseDeviationRepeatability.items.push({ radiationType: type })
      this.form.doseDeviationRepeatability.items.filter((item) => item.radiationType == type).forEach((item, index) => item.sort = index + 1)
    },
    // 剂量偏差与重复性 => (398)删行 1: X射线 2: 电子线
    handleDelete398ItemsRow(type = 1, row, index) {
      if (index == 0) return
      const findIndex = this.form.doseDeviationRepeatability.items.findIndex((item) => item.radiationType == type && item.sort == row.sort)
      this.form.doseDeviationRepeatability.items.splice(findIndex, 1)
      this.form.doseDeviationRepeatability.items.filter((item) => item.radiationType == type).forEach((item, index) => item.sort = index + 1)
    },
    // 剂量偏差与重复性 => (277)添行
    handleAddItemsRow() {
      this.form.doseDeviationRepeatability.items.push({ radiationType: 1 })
    },
    // 剂量偏差与重复性 => (277)删行
    handleDeleteItemsRow(index) {
      if (index == 0) return
      this.form.doseDeviationRepeatability.items.splice(index, 1)
    },
    //修改数据
    setData(name, data) {
      this.form[name] = data || {};
    },
    //表单修改提交后端
    postForm(param, name) {
      param["itemsId"] = this.form.itemsId;
      this.$emit("loadingchange", true);
      postInfo(param, this[name].action).then((res) => {
        this.$emit("loadingchange", false);
        if (res.code == 200) {
          this[name].flag = false;
          if (name != "sdd") {
            this.setData(name, res.data);
          }
        }
      });
    },
    validateType(arr, keys, obj) {
      if (obj.like) {
        for (let i = 0; i < arr.length; i++) {
          if (keys.indexOf(arr[i]) != -1) {
            return true;
          }
        }
        return false;
      } else {
        if (arr.indexOf(keys) != -1) {
          return true;
        }
        return false;
      }
    },
    //数据验证
    validateData(newName, myName) {
      if (!this[myName].noClear) {
        clearTimeout(this[myName].loading);
      } else {
        this[myName].noClear = false;
      }
      let regNumber = /^[-]?\d*([.](\d+))?$/; //小数验证正则
      let regRepNumber = /[^-?\d.,]/g; //将除小数外的符号消除正则
      let regInt = /^\d*$/; //整数验证正则
      let regRepInt = /[^-?\d,]/g; //将除小数外的符号消除正则
      let reg, regRep;
      let repStr = "";
      let intResult;
      if (JSON.stringify(newName) != "{}") {
        //遍历该对象所有字段进行验证
        for (let keys in newName) {
          //数字验证环节
          if (
            typeof newName[keys] == "string" ||
            typeof newName[keys] == "number"
          ) {
            if (
              newName[keys] &&
              !this.validateType(this[myName].notNumber, keys, this[myName])
            ) {
              intResult = this.validateType(
                this[myName].intNumber,
                keys,
                this[myName]
              );
              reg = intResult ? regInt : regNumber;
              let bool = !reg.test(newName[keys]);
              if (bool) {
                setTimeout(() => {
                  intResult = this.validateType(
                    this[myName].intNumber,
                    keys,
                    this[myName]
                  );
                  regRep = intResult ? regRepInt : regRepNumber;
                  repStr = newName[keys] + "";
                  repStr = repStr.replace(regRep, "");
                  if (repStr != newName[keys] + "") {
                    if (!this[myName].noClear) {
                      this[myName].noClear = true;
                    }
                    newName[keys] = repStr;
                  }
                }, 100);
                if (this[myName].flag) {
                  this[myName].flag = false; //如果数字验证不通过不需要请求后端
                }
              }
            }
          }
        }
        this.isPost(newName, myName);
      }
    },
    isPost(newName, myName) {
      if (this[myName].flag) {
        //是否请求后端判断
        let postBody = {};
        for (let i in newName) {
          if (newName[i] !== null && newName[i] !== undefined) {
            postBody[i] = newName[i];
          }
        }
        if (JSON.stringify(postBody) != "{}") {
          this[myName].loading = setTimeout(() => {
            this.postForm(postBody, myName);
          }, 800);
        }
      } else {
        this[myName].flag = true;
      }
    },
  },
  watch: {
    activeNameEquipment: {
      handler(val) {
        this.$nextTick(() => {
          let resultId = this.basicForm.resultId;
          getInfoById50(resultId)
            .then((response) => {
              if (response.code == 200) {
                let data = response.data;
                for (let keys in data) {
                  this.form[keys] = data[keys] || {};
                }
                if (this.form.doseDeviationRepeatability.type == 1) { // 398
                  const existXRay = this.form.doseDeviationRepeatability?.items?.find((item) => item.radiationType == 1)
                  const existEleRay = this.form.doseDeviationRepeatability?.items?.find((item) => item.radiationType == 2)
                  if (!this.form.doseDeviationRepeatability.items) {
                    this.form.doseDeviationRepeatability.items = [
                      { radiationType: 1, sort: 1 },
                      { radiationType: 2, sort: 1 },
                    ]
                  } else if (!existXRay) {
                    this.form.doseDeviationRepeatability.items.push({ radiationType: 1, sort: 1 })
                  } else if (!existEleRay) {
                    this.form.doseDeviationRepeatability.items.push({ radiationType: 2, sort: 1 })
                  }
                } else { // 277
                  this.form.doseDeviationRepeatability.items = this.form.doseDeviationRepeatability.items || [{}];
                }
                setTimeout(() => {
                  this.initFlag = true;
                }, 300);
              }
            })
            .catch((response) => {
              this.$emit("loadingchange", true);
            });
        });
      },
      deep: true,
      immediate: true,
    },
    "form.doseDeviationRepeatability": {
      handler(newName, oldName) {
        if (this.initFlag) {
          this.validateData(newName, "doseDeviationRepeatability");
        }
      },
      deep: true,
    },
    "form.doseLinearity": {
      handler(newName, oldName) {
        if (this.initFlag) {
          this.validateData(newName, "doseLinearity");
        }
      },
      deep: true,
    },
    "form.uniformity": {
      handler(newName, oldName) {
        if (this.initFlag) {
          this.validateData(newName, "uniformity");
        }
      },
      deep: true,
    },
    "form.symmetry": {
      handler(newName, oldName) {
        if (this.initFlag) {
          this.validateData(newName, "symmetry");
        }
      },
      deep: true,
    },
    "form.shifting": {
      handler(newName, oldName) {
        if (this.initFlag) {
          this.validateData(newName, "shifting");
        }
      },
      deep: true,
    },
  },
};
</script>

<style lang="scss" scoped>
@import "../content.scss";

.miniFont {
  font-size: 10px;
}

.miniFontCenter {
  margin-top: 8px;
}

.content50 {
  padding-inline: 0 !important;
  ::v-deep .el-input__suffix {
    display: none;
  }
  table {
    width: 100%;

    td {
      // max-width: 100px;

      ::v-deep .el-checkbox__label {
        white-space: break-spaces;
      }
    }

    .el-input {
      width: 100%;
    }

    .multipleInput {
      .el-input {
        width: 50px !important;
      }
    }
  }

  .innertitle {
    display: block;
    margin-left: 0;
  }

  .table1 {
    .el-radio {
      display: flex;
      align-items: center;
    }
  }

  #hearderTR td:nth-child(7) {
    display: none;
  }
}
</style>
